package com.hf.application

import org.springframework.beans.BeansException
import org.springframework.context.ApplicationContext
import org.springframework.context.ApplicationContextAware

class ApplicationContextHolder implements ApplicationContextAware {

	private static ApplicationContext context;

	@Override
	public void setApplicationContext(ApplicationContext context) throws BeansException {
		this.context = context
	}

	public static ApplicationContext getApplicationContext(){
		return context
	}

	public static Object getBean(String beanName) {
		return context?.getBean(beanName);
	}
}
